package com.xiaodeng.xdblogspringboot.exception;

import com.xiaodeng.xdblogspringboot.pojo.Result;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

@Data
@AllArgsConstructor
@NoArgsConstructor
public class ApplicationException extends RuntimeException{
    private Integer code;//业务状态码
    private String message;//提示信息
    private Object data;//响应数据

    public ApplicationException(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    // 返回 Result 对象的方法
    public Result applicationException() {
        return new Result(code, message,data);
    }


}
